import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import path from "path";
import autoprefixer from "autoprefixer";
//@ts-expect-error - 模块缺少类型定义
import px2viewport from "postcss-px-to-viewport";

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    tailwindcss(),
    react({
      babel: {
        plugins: [["babel-plugin-react-compiler"]],
      },
    }),
  ],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"),
    },
  },
  css: {
    postcss: {
      plugins: [
        autoprefixer(),
        px2viewport({
          viewportWidth: 375,
        }),
      ],
    },
  },
});
